package com.jinmdz.fmis.api.api.controller;

import com.jinmdz.fmis.api.api.model.common.IdVersionData;
import com.jinmdz.fmis.api.api.model.facelift.FaceLiftData;
import com.jinmdz.fmis.api.api.model.funeral.negotiation.NegotiationFaceLiftItem;
import com.jinmdz.fmis.api.api.service.FaceLiftService;
import com.jinmdz.fmis.api.base.BaseController;
import com.jinmdz.fmis.core.base.BaseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.ArrayList;


/**
 * 整容任务信息相关接口
 *
 * @author LiCongLu
 * @date 2020-01-20 11:29
 */
@Api(description = "整容任务信息相关接口")
@RestController()
@RequestMapping("/api/face-lift")
public class FaceLiftController extends BaseController {

    @Resource
    private FaceLiftService faceLiftService;

    /**
     * 保存整容信息到face_lift_item表中
     *
     * @param data 整容费用
     * @return
     * @author LiCongLu
     * @date 2020-01-20 11:31
     */
    @ApiOperation(value = "保存整容信息到face_lift_item表中", notes = "保存整容任务信息到face_lift_item表中")
    @PostMapping("/save-face-lift")
    public BaseResult<ArrayList<NegotiationFaceLiftItem>> saveFaceLift(@RequestBody FaceLiftData data) {
        return resultHandler(data, userItem -> faceLiftService.saveFaceLift(userItem, data));
    }

    /**
     * 从face_lift_item表中删除指定id的整容任务信息记录
     *
     * @param data 主键和本版号
     * @return
     * @author LiCongLu
     * @date 2020-01-20 11:33
     */
    @ApiOperation(value = "从face_lift_item表中删除指定id的整容任务信息记录", notes = "从face_lift_item表中删除指定id的整容任务信息")
    @PostMapping("/delete-face-lift-with-id")
    public BaseResult deleteFaceLiftWithId(@RequestBody IdVersionData data) {
        return resultHandler(data, userItem -> faceLiftService.deleteFaceLiftWithId(userItem, data));
    }
}
